<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos  -->
			<title>Validators</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
						<script src="../media/lib/classTree.js"></script>
												<script language="javascript" type="text/javascript">
				var imgPlus = new Image();
				var imgMinus = new Image();
				imgPlus.src = "../media/images/plus.png";
				imgMinus.src = "../media/images/minus.png";
				
				function showNode(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
							var oImg = document.layers["img" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
							var oImg = document.all["img" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
							var oImg = document.getElementById("img" + Node);
									break;
							}
					oImg.src = imgMinus.src;
					oTable.style.display = "block";
				}
				
				function hideNode(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
							var oImg = document.layers["img" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
							var oImg = document.all["img" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
							var oImg = document.getElementById("img" + Node);
									break;
							}
					oImg.src = imgPlus.src;
					oTable.style.display = "none";
				}
				
				function nodeIsVisible(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
									break;
							}
					return (oTable && oTable.style.display == "block");
				}
				
				function toggleNodeVisibility(Node){
					if (nodeIsVisible(Node)){
						hideNode(Node);
					}else{
						showNode(Node);
					}
				}
			</script>
					</head>
		<body>
			<div class="page-body">			
	<table class="tutorial-nav-box">
	<tr>
		<td style="width: 30%">
							<a href="../Nexista/tutorial_config.runtime.cache.pkg.html"><img src="../media/images/previous_button.png" alt="Previous"></a>
					</td>
		<td style="text-align: center">
							<a href="../Nexista/tutorial_reference.pkg.html"><img src="../media/images/up_button.png" alt="Up"></a>
					</td>
		<td style="text-align: right; width: 30%">
							<a href="../Nexista/tutorial_validator.validators.pkg.html"><img src="../media/images/next_button.png" alt="Next"></a>
					</td>
	</tr>
	<tr>
		<td style="width: 30%">
							<span class="detail">cache</span>
					</td>
		<td style="text-align: center">
							<span class="detail">Reference</span>
					</td>
		<td style="text-align: right; width: 30%">
							<span class="detail">validators</span>
					</td>
	</tr>
</table>
	
<div><a name=""></a><div class="ref-title-box"><h1 class="ref-title">Validators</h1></div>

 <span><a name="overview"></a><h2 class="title">Overview</h2><p>Validators are special handlers that allow developers to validate data and
peform actions based on the overall result.</p>
<p>The validation system uses an XML file to define the validators needed for
a particular situation. Validators come in many types and are located in the
modules/validators folder. All validators are classes that are extended from
the base Validator class. To create your own, just copy one
of the existing ones and modify it to suit your needs.</p>

<p>Example validator file (i.e. myValidator.xml):</p>
 <pre class="listing"><pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;validators name=&quot;form_validation&quot; debug=&quot;false&quot;&gt;
&lt;param name=&quot;email&quot; text=&quot;Email Address&quot;&gt;
&lt;validator type=&quot;email&quot; params=&quot;flow://_post/email&quot;&amp;nbsp;required=&quot;true&quot;/&gt;
&lt;/param&gt;
&lt;/validators&gt;</pre></pre>

<p>Example sitemap validator tag:</p>
 <pre class="listing"><pre>
&lt;map:gate match=&quot;sampleform&quot;&gt;
&lt;!-- see if submit button was pressed --&gt;
&lt;map:if name=&quot;_post/submit&quot;&gt;
     &lt;map:true&gt;
          &lt;map:validate src=&quot;myvalidator.xml&quot;/&gt;
             &lt;!-- form is valid --&gt;
             &lt;map:valid&gt;
                 &lt;!-- here we can do some action to handle form data.--&gt;
                  &lt;map:debug text=&quot;Form submitted&quot;/&gt;
             &lt;/map:valid&gt;
             &lt;!-- form is bad. We reshow with errors --&gt;
             &lt;map:invalid&gt;
                 &lt;map:xsl src=&quot;myform.xsl&quot;/&gt;
             &lt;/map:invalid&gt;
         &lt;/map:validate&gt;
     &lt;/map:true&gt;
     &lt;map:false&gt;
         &lt;!-- the form was not submitted. We show initial form --&gt;
         &lt;map:xsl src=&quot;myform.xsl&quot;/&gt;
     &lt;/map:false&gt;
 &lt;/map:if&gt;
&lt;/map:gate&gt;
</pre></pre>
            <p>XSL code can also be added to present a message in the stylesheet:</p>

 <pre class="listing"><pre>
...
&lt;xsl:if test=&quot;//validation&quot;&gt;
    &lt;div class=&quot;error&quot;&gt;This form contains errors. Please check the following fields:&lt;/div&gt;
    &lt;ul&gt;
    &lt;xsl:for-each select=&quot;//validation/*&quot;&gt;
        &lt;xsl:for-each select=&quot;failed&quot;&gt;
        &lt;li&gt;&lt;xsl:value-of select=&quot;../text&quot;/&gt;&amp;#160;&lt;xsl:value-of select=&quot;*/text()&quot;/&gt;&lt;/li&gt;
        &lt;/xsl:for-each&gt;
    &lt;/xsl:for-each&gt;
    &lt;/ul&gt;
&lt;/xsl:if&gt;
...
&lt;xsl:if test=&quot;validation/email/failed&quot;&gt;
&lt;xsl:attribute name=&quot;class&quot;&gt;error&lt;/xsl:attribute&gt;
&lt;/xsl:if&gt;
&lt;div&gt;Email&lt;/div&gt;
&lt;input type=&quot;text&quot; name=&quot;email&quot; value=&quot;{//_post/email}&quot;/&gt;
</pre></pre>&gt;</span>

 <span><a name="reference"></a><h2 class="title">Reference</h2><p>This is a reference for validator file directives</p>
 <ul mark = "bullet"><li><p><a href="../Nexista/tutorial_validator.validators.pkg.html">validators</a></p></li>
<li><p><a href="../Nexista/tutorial_validator.param.pkg.html">param</a></p></li>
<li><p><a href="../Nexista/tutorial_validator.validator.pkg.html">validator</a></p></li></ul></span></div>

	<table class="tutorial-nav-box">
	<tr>
		<td style="width: 30%">
							<a href="../Nexista/tutorial_config.runtime.cache.pkg.html"><img src="../media/images/previous_button.png" alt="Previous"></a>
					</td>
		<td style="text-align: center">
							<a href="../Nexista/tutorial_reference.pkg.html"><img src="../media/images/up_button.png" alt="Up"></a>
					</td>
		<td style="text-align: right; width: 30%">
							<a href="../Nexista/tutorial_validator.validators.pkg.html"><img src="../media/images/next_button.png" alt="Next"></a>
					</td>
	</tr>
	<tr>
		<td style="width: 30%">
							<span class="detail">cache</span>
					</td>
		<td style="text-align: center">
							<span class="detail">Reference</span>
					</td>
		<td style="text-align: right; width: 30%">
							<span class="detail">validators</span>
					</td>
	</tr>
</table>
	
	<p class="notes" id="credit">
		Documentation generated on Wed, 03 May 2006 13:48:44 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.0RC3</a>
	</p>
	</div></body>
</html>